import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDictSever extends UdpEchoserver{
    private Map<String,String> dict = new HashMap<>();

    public UdpDictSever(int port) throws SocketException {
        super(port);

        dict.put("dog","小狗");
        dict.put("cat","小猫");
        dict.put("apple","苹果");
        dict.put("fuck","我去");
    }

    //重写process
    @Override
    public String process(String request){
        return dict.getOrDefault(request,"未录入~");
    }

    public static void main(String[] args) throws IOException {
        UdpDictSever udpDictSever = new UdpDictSever(9090);
        udpDictSever.start();
    }
}
